package person.bing.fbcloud.leetcode;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author: mengfanbing
 * @date: 2020/8/27 9:47
 */
public class Q332 {
    public static void main(String[] args) {

    }

    public static List<String> findItinerary(List<List<String>> tickets) {
        List<String> ans = new ArrayList<>();
        /*int size = tickets.size();
        List<List<String>> jfkTickets = tickets.stream()
                .filter(ticket -> ticket.get(0).equals("JFK"))
                .sorted()
                .collect(Collectors.toList());
        List<List<String>> otherTickets = tickets.stream()
                .filter(ticket -> false==ticket.get(0).equals("JFK"))
                .sorted()
                .collect(Collectors.toList());
        List<String> jfkTicket = jfkTickets.get(0);
        ans.add("JFK");
        String jfkNextStation = jfkTicket.get(1);
        ans.add(jfkNextStation);
        tickets.remove(jfkTicket);
        String lastStation = jfkNextStation;
        while (size > 1){
            List<String> station = tickets.stream()
                    .filter(ticket -> ticket.get(0).equals(lastStation))
                    .collect(Collectors.toList())
                    .get(0);
            ans.add(station.get(1));
            lastStation = station.get(1)
            tickets.remove(station);
        }*/
        return ans;
    }
}
